#pragma once

#define SIZE 1024

#define FLUSH_NONE 0
#define FLUSH_LINE 1
#define FLUSH_FULL 2

struct FILE_IO{
    int flush_way; //刷新方式
    int fileno; //文件描述符
    char outbuffer[SIZE]; //输出缓冲区
    int size; //缓冲区的有效数据的大小
    int capacity; //缓冲区的容量
};

typedef struct FILE_IO mFILE;

mFILE* mfopen(const char* filename, const char* mode);
int mfwrite(const void* ptr, int num, mFILE* stream);
int mfflush(mFILE* stream);
int mfclose(mFILE* stream);

